﻿<%@ Page Title="店铺档案" Language="C#" MasterPageFile="~/master/m.master" %>

<script runat="server"></script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../assets/css/plugins/footable/footable.core.css" rel="stylesheet">
    <link href="../assets/css/shelf/base.css" rel="stylesheet">
    <link href="../assets/css/plugins/iCheck/customsmall.css" rel="stylesheet" />
    <link href="../assets/css/plugins/select2/select2.min.css" rel="stylesheet" />
    <link href="../assets/css/plugins/select2/select2-bootstrap.min.css" rel="stylesheet" />
    <link href="../assets/css/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
    <style type="text/css">
        .system-box .right-side {
            width: 100%;
        }

        .condition, .condition-title {
            border-bottom: 1px solid #dfdfdd;
        }

            .condition .form-control {
                padding: 2px 6px;
            }

        .condition-title {
            padding: 4px 12px;
            font-size: 12px;
            font-weight: bold;
            background: #fff;
        }

        .replenishDay,
        .billandPickDay,
        .transportDay,
        .shopRate {
            width: 30px;
        }

        .condition .checkBoxTime {
            margin-left: 10px;
            position: relative;
            top: 2px;
        }

        .condition .timeTitle {
            line-height: 34px;
            display: inline-block;
            position: relative;
            border-right: 1px solid #dfdfdd;
            border-bottom: 1px solid #dfdfdd;
            padding-left: 7px;
            width: 50px;
            cursor: pointer;
            float: left;
        }

            .condition .timeTitle .icon {
                font-size: 11px;
                position: absolute;
                right: 1px;
                bottom: 1px;
                display: none;
                color: #fff;
            }

            .condition .timeTitle.check {
                background: linear-gradient(135deg, #fff 74%,#00a0e5 78%,#00a0e5 100%);
            }

                .condition .timeTitle.check .icon {
                    display: block;
                }

        #toggle {
            float: right;
            width: 100px;
            height: 34px;
            cursor: Pointer;
            line-height: 34px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="Server">
    <div class="system-box">
        <div class="right-side">
            <div class="btns-container"></div>
            <div class="condition">
                <label>关键字</label>
                <input type="text" class="form-control input-w170" id="search-keys" placeholder="店铺代码或名称" />
                <!--<label>零售区域</label>
			<select class="form-control input-w170" id="serarch-retail">
				<option value="">全部</option>
			</select>-->
                <label>店铺状态</label>
                <select class="form-control input-w170" id="serarch-state">
                    <option value="">全部</option>
                </select>
                <label>店铺等级</label>
                <select class="form-control input-w170" id="search-level">
                    <option value="">全部</option>
                </select>
                <label>物流天数</label>
                <select id="symbol" class="form-control input-w120">
                    <option value=">=">&gt;=</option>
                    <option value="<=">&lt;=</option>
                </select>
                <input type="number" id="transportDayVal" class="form-control input-w160" placeholder="物流天数" />
            </div>
            <div class="condition">
                <label>商品区域</label>
                <select class="form-control input-w170" id="serarch-commodity">
                    <option value="">全部</option>
                </select>
                <label>省份</label>
                <select class="form-control input-w170" id="serarch-province">
                    <option value="">全部</option>
                </select>
                <label>城市</label>
                <select class="form-control input-w170" id="serarch-city">
                    <option value="">全部</option>
                </select>
                <div>
                    <span id="toggle" class="info">展开设置 >></span>
                </div>
            </div>
            <div id="tips" class="condition-title hide">
                参数设置
                <span class="text-warning">调出店铺：是否参与调拨系统调出店铺；调入店铺：是否参与调拨系统调入店铺 ；参与配补：是否参与补、配货。</span>
            </div>

            <div id="paramSet" class="condition hide" style="overflow: visible !important;">
                <label>设置类型</label>
                <select id="dayType" class="form-control input-w120">
                    <option value="0">物流天数</option>
                    <%--<option value="1">补货间隔</option>--%>
                    <option value="2">做单拣货</option>
                    <option value="3">补货需求系数</option>
                </select>
                <input type="number" class="form-control diy-td-w50" id="setDays" placeholder="天数" />
                <label for="search-operator">操作员：</label>
                <div class="pull-left">
                    <select id="search-operator" class="form-control input-w90 pull-left">
                        <option value="">请选择</option>
                    </select>
                </div>
                <label for="setting-pbd">设置配补调</label>
                <div class="pull-left">
                    <select id="setting-pbd" class="input-w140 selectpicker" data-style="backselect" multiple>
                        <option value="out">调出店铺</option>
                        <option value="in">调入店铺</option>
                        <option value="charge">参与配补</option>
                    </select>
                </div>
                <div class="pull-left center" style="line-height: 34px">
                    <input type="radio" name="pdb" id="is_setting" />是
                    <input type="radio" name="pdb" id="not_setting" />否
                </div>
                <div class="visible-sm visible-xs" style="clear: both;"></div>
                <label>补货时间</label>
                <%--<input type="text" class="form-control layer-date input-w240" readonly="readonly" id="dealDate" placeholder="补货时间" />--%>
                <div class="cb" style="padding: 0 0 0 10px; overflow: hidden;">
                    <input type="checkbox" class="checkBoxTime hide" value="星期一" /><span class="timeTitle">星期一<i class="fa fa-check icon"></i></span>
                    <input type="checkbox" class="checkBoxTime hide" value="星期二" /><span class="timeTitle">星期二<i class="fa fa-check icon"></i></span>
                    <input type="checkbox" class="checkBoxTime hide" value="星期三" /><span class="timeTitle">星期三<i class="fa fa-check icon"></i></span>
                    <input type="checkbox" class="checkBoxTime hide" value="星期四" /><span class="timeTitle">星期四<i class="fa fa-check icon"></i></span>
                    <input type="checkbox" class="checkBoxTime hide" value="星期五" /><span class="timeTitle">星期五<i class="fa fa-check icon"></i></span>
                    <input type="checkbox" class="checkBoxTime hide" value="星期六" /><span class="timeTitle">星期六<i class="fa fa-check icon"></i></span>
                    <input type="checkbox" class="checkBoxTime hide" value="星期日" /><span class="timeTitle">星期日<i class="fa fa-check icon"></i></span>
                </div>
            </div>

            <div class="right-content-box">
                <div class="ibox-content">
                    <table class="footable table table-stripped table-list">
                        <thead></thead>
                        <tbody id="pageList"></tbody>
                    </table>
                </div>
            </div>

            <div class="pageControl"></div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="footer" runat="Server">
    <script src="../assets/js/page/pageControl.js"></script>
    <script src="../assets/js/page/rScroll.js"></script>
    <script src="../assets/js/page/tableControl.js"></script>
    <script src="../assets/js/plugins/layer/laydate/laydate.js"></script>
    <script src="../assets/js/plugins/iCheck/icheck.min.js"></script>
    <script src="../assets/js/plugins/iCheck/icheckAll.js"></script>
    <script src="../assets/js/plugins/select2/select2.full.min.js"></script>
    <script src="../assets/js/plugins/select2/i18n/zh-CN.js"></script>
    <script src="../assets/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>
    <script src="../assets/js/plugins/bootstrap-select/i18n/defaults-zh_CN.min.js"></script>
    <script type="application/javascript">
        $('document').ready(function () {
            //模块ID
            var ModuleID = Y.getUrlParam("ModuleID");
            //当前页数
            var page = 1;
            //获取按钮
            commonUtil.loadBtnList(ModuleID, function () {
                rScroll();
            });

            $('.condition .timeTitle').click(function () {
                if ($(this).hasClass('check')) {
                    $(this).removeClass('check');
                } else {
                    $(this).addClass('check');
                }
                $('.checkBoxTime').eq($('.condition .timeTitle').index(this)).click();
            })

            Y.API2('PickingOperations', 'GetOperator', {}, function (data) {
                var newdata = $.map(data, function (obj) {
                    obj.id = obj.UserCode;
                    obj.text = obj.UserName;
                    return obj;
                });

                $("#search-operator").select2({
                    language: "zh-CN",
                    theme: "bootstrap",
                    placeholder: "选择",
                    data: newdata
                });
                //选中当前用户
                //var UserInfo = JSON.parse(window.sessionStorage.getItem('login-info'));
                //if (!Y.checkNull(UserInfo) && !Y.checkNull(UserInfo.NickName)) {
                //    // UserInfo.NickName = "xxx";
                //    $("#search-operator option:contains('" + UserInfo.NickName + "')").map(function () {
                //        if ($(this).text() == UserInfo.NickName) {
                //            $(this).prop("selected", true);
                //            $("#search-operator").trigger('change');
                //        }
                //    });

                //}
            });

            //设置配补调按钮
            $('.btns-container').on('click', '#btn-setting-pbd', function () {
                if ($('#pageList .checkStore:checked').size() == 0) {
                    swal('请先选择店铺');
                    return false;
                }
                debugger;
                var array = $("#setting-pbd").selectpicker("val");
                if (Y.checkNull(array) || array.length < 1) {
                    swal("请选择一项调入店铺,调出店铺或者参与配补");
                    return false;
                }
                if ($("#is_setting").prop("checked") == false && $("#not_setting").prop("checked") == false) {
                    swal("请选择设置为是 - 或者否");
                    return false;
                }
                layer.msg('玩命加载中……', { icon: 16, shade: 0.5, time: 0, maxWidth: 200 });
                var list = [];
                var out_shop = -1;
                var in_shop = -1;
                var charge_shop = -1;
                var is_setting = -1;
                $('#pageList .checkStore:checked').each(function () {
                    var tr = $(this).parents('tr');
                    var item = { ShopCode: tr.find('.shopCode').text() };
                    list.push(item);
                })
                if ($("#is_setting").prop("checked")) {
                    is_setting = 1;
                } else {
                    is_setting = 0;
                }
                array.map(function (i) {
                    if (i == "out") {
                        out_shop = is_setting;
                    }
                    else if (i == "in") {
                        in_shop = is_setting;
                    }
                    else if (i == "charge") {
                        charge_shop = is_setting;
                    }
                });
                Y.API2('DwShop', 'ModifyDwShopPDB', {
                    list: list,
                    IsMoveShop: out_shop,
                    IsInShop: in_shop,
                    ISDwMvShop: charge_shop,
                }, function (data) {
                    layer.closeAll('dialog');
                    if (data.Success == false) {
                        swal(data.Message, '', 'error');
                    } else {
                        swal('修改成功', '', 'success');
                        $('#btn-search').click();
                    }
                })

            })

            //处理表头
            if ($('.footable thead').children().size() == 0) {
                tableControl.initThead('.footable', [
                    {
                        trClass: '', children: [
                            { tdText: '', c: 0, r: 0, tdHtml: '<input type="checkbox" id="checkAllStore" />', tdId: '', tdClass: '' },
                            //{tdText: '公司代码', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '店铺代码', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '店铺名称', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '店铺级别', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '店铺状态', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '是否调出', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '是否调入', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '参与补配', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },

                            //              	{tdText: '零售区域', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '商品区域', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '省份', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '城市', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '发货仓库', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: 'SKC数量', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '操作人', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '补货时间', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '物流天数', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            //              	{tdText: '补货间隔', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '做单拣货', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                            { tdText: '补货需求系数', c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                        ]
                    }
                ])
            }


            var loadList = function () {
                var keys = $('#search-keys').val().trim().replace(/'/g, '');
                var transportDayVal = parseInt($('#transportDayVal').val());
                var shop_level;
                if (!Y.checkNull($('#search-level').find("option:selected").text()) && $('#search-level').val() != "") {
                    shop_level = $('#search-level').find("option:selected").text();
                }

                pageControl.init('DwShop', 'GetDwShopList', {
                    Keys: keys,
                    AreaID: $('#serarch-commodity').val(),
                    ProID: $('#serarch-province').val(),
                    CityID: $('#serarch-city').val(),
                    ShopLevelCode: shop_level,
                    ShopState: $('#serarch-state').val(),
                    Symbol: $('#symbol').val(),
                    TransportDay: isNaN(transportDayVal) ? "" : transportDayVal,
                    //			OperationAreaID: $('#serarch-retail').val(),
                    Page: page,
                    Size: 100,
                    needLayer: true,
                    alwaysCallBack: function () {
                        $('#pageList').empty();
                    }
                }, function (result) {
                    page = result.page;
                    var tBody = [];
                    if (!Y.checkNull(result.data)) {
                        if (result.data.Items.length > 0) {
                            result.data.Items.map(function (item, i) {
                                var tempTr = {
                                    trClass: (i % 2 == 0 ? 'gradeX footable-even' : 'gradeX footable-odd'),
                                    children: [
                                        { tdText: '', c: 0, r: 0, tdHtml: '<input type="checkbox" class="checkStore" />', tdId: '', tdClass: '' },
                                        //{tdText:(item.CompanyID || ''), c:0 , r:0, tdHtml:'', tdId:'', tdClass:''},
                                        { tdText: (item.ShopCode || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: 'shopCode' },
                                        { tdText: (item.ShopName || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.ShopLevelCode || ' '), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.ShopState || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.IsMoveShop == 1 ? "是" : "否"), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: 'IsMoveShop' },
                                        { tdText: (item.IsInShop == 1 ? "是" : "否"), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: 'IsInShop' },
                                        { tdText: (item.ISDwMvShop == 1 ? "是" : "否"), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: 'ISDwMvShop' },

                                        //								{tdText:(item.OperationAreaName || ' '), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.DistrictName || ' '), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.ParentAreaName || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.AreaName || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.StockName || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.StandardDisplaySKC || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: (item.UserCode || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: 'hide UserCode' },
                                        { tdText: (item.UserName || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: 'UserName' },
                                        { tdText: (item.SuppleWeekText ? item.SuppleWeekText : ' '), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: '', c: 0, r: 0, tdHtml: '<input type="number" value="' + item.TransportDay + '" class="transportDay" />', tdId: '', tdClass: '' },
                                        //								{ tdText: (item.ReplenishDay || ''), c: 0, r: 0, tdHtml: '', tdId: '', tdClass: '' },
                                        { tdText: '', c: 0, r: 0, tdHtml: '<input type="number" value="' + item.BillandPickDay + '" class="billandPickDay" />', tdId: '', tdClass: '' },
                                        { tdText: '', c: 0, r: 0, tdHtml: '<input type="number" value="' + item.ShopRate + '" class="shopRate" />', tdId: '', tdClass: '' },
                                    ]
                                };
                                tBody.push(tempTr);
                            })
                        }
                        rScroll();
                    }
                    tableControl.initTbody('.footable', (tBody.length > 0 ? tBody : null), 11, null);
                    //选择全部插件 2017-05-02 改
                    $(".footable").icheckAll({
                        checkObj: ".checkStore",//表格下面的选择控件对象 选择器
                        checkAllObj: "#checkAllStore",//全选 选择器
                        clickoutBoxCheck: false,//点击行 不选中
                        checkboxMargin: "4px 0 0 0 "//上右下左
                    });

                });
            }

            //初始化下拉框
            //商品区域
            commonUtil.bindDwGlobalVariables({ dictValue: '商品区域' }, ['#serarch-commodity']);
            //获取店铺等级
            //commonUtil.bindDwGlobalVariables({ dictValue: '推台SKC数' }, ['#search-level']);
            commonUtil.bindGlobalVariableListShop({ InfoType: 'ShopLevel' }, ['#search-level']);
            //店铺等级
            //layer.msg('玩命加载中……', { icon: 16, shade: 0.5, time: 0, maxWidth: 200 });
            //Y.API2('DwShop', 'GetShopAndCustBaseInfo', { InfoType: 'ShopLevel' }, function (data) {
            //    if (data.Success == false) {
            //        layer.closeAll('dialog');
            //        swal(data.Message, '', 'error');
            //    } else {
            //        data.map(function (item) {
            //            $('#search-level').append('<option value="' + item.InfoName + '">' + item.InfoName + '</option>');
            //        })


            //    }
            //});
            //店铺状态
            layer.msg('玩命加载中……', { icon: 16, shade: 0.5, time: 0, maxWidth: 200 });
            Y.API2('DwShop', 'GetShopAndCustBaseInfo', { InfoType: 'ShopState' }, function (data) {
                if (data.Success == false) {
                    swal(data.Message, '', 'error');
                } else {
                    data.map(function (item) {
                        if (item.InfoName == '正常营业')
                            $('#serarch-state').append('<option selected="selected" value="' + item.InfoName + '">' + item.InfoName + '</option>');
                        else
                            $('#serarch-state').append('<option value="' + item.InfoName + '">' + item.InfoName + '</option>');
                    })
                    loadList();
                }
                layer.closeAll('dialog');
            });
            //省份&城市
            var provinceList = [];
            var loadAreaList = function () {
                Y.API2('OdsErpBasArea', 'GetOdsErpBasAreaList', {
                    Param: 1,
                    DistrictID: $('#serarch-commodity').val()
                }, function (data) {
                    if (data.Success == false) {
                        swal(data.Message, '', 'error');
                    } else {
                        data.map(function (item) {
                            provinceList.push(item);
                            $('#serarch-province').append('<option value="' + item[0].ParentID + '">' + item[0].ParentName + '</option>');
                        })
                    }
                });
            }

            //选择商品区域
            $('#serarch-commodity').change(function () {
                $('#serarch-province').empty();
                $('#serarch-province').append('<option value="">全部</option>');
                $('#serarch-city').empty();
                $('#serarch-city').append('<option value="">全部</option>');
                if ($(this).val() == '')
                    return false;
                loadAreaList();
            })

            //选择省份
            $('#serarch-province').change(function () {
                $('#serarch-city').empty();
                $('#serarch-city').append('<option value="">全部</option>');
                var $this = $(this);
                provinceList.map(function (item) {
                    if (item[0].ParentID == $this.val()) {
                        item.map(function (city) {
                            $('#serarch-city').append('<option value="' + city.AreaID + '">' + city.AreaName + '</option>');
                        });
                        $('#serarch-city').val('');
                        return false;
                    }
                })
            });

            //查询按钮
            $('.btns-container').on('click', '#btn-search', function () {
                page = 1;
                loadList();
            })


            //修正补货间隔
            $('#pageList').on('blur', '.replenishDay', function () {
                if (isNaN(parseInt($(this).val())))
                    $(this).val('');
            });

            //修正做单拣货
            $('#pageList').on('blur', '.billandPickDay', function () {
                if (isNaN(parseInt($(this).val())))
                    $(this).val('');
            });

            //修正补货需求系数
            $('#pageList').on('blur', '.shopRate', function () {
                if (isNaN(parseInt($(this).val())))
                    $(this).val('');
            });

            //批量修改天数
            $('.btns-container').on('click', '#saveDays', function () {
                if ($('#pageList .checkStore:checked').size() == 0) {
                    swal('请先选择店铺');
                    return false;
                }
                var setDays = parseInt($('#setDays').val());
                var list = [];
                if (isNaN(setDays)) {
                    //单个
                    var doSubmit = true;
                    $('#pageList .checkStore:checked').each(function () {
                        var tr = $(this).parents('tr');
                        var tempT = parseInt(tr.find('.transportDay').val());
                        var tempR = parseInt(tr.find('.replenishDay').val());
                        var tempP = parseInt(tr.find('.billandPickDay').val());
                        var tempS = parseFloat(tr.find('.shopRate').val());
                        var item = { ShopCode: tr.find('.shopCode').text() };
                        if (isNaN(tempT) && isNaN(tempP) && isNaN(tempS)) {
                            swal('所选店铺物流天数、做单拣货、补货需求系数未填或有误');
                            doSubmit = false;
                        }
                        else {
                            if (!isNaN(tempT)) {
                                item.TransportDay = tempT;
                            }
                            if (!isNaN(tempP)) {
                                item.BillandPickDay = tempP;
                            }
                            if (!isNaN(tempS)) {
                                item.ShopRate = tempS;
                            }
                        }
                        list.push(item);
                    })
                    //debugger;
                    if (!doSubmit)
                        return false;
                    layer.msg('玩命加载中……', { icon: 16, shade: 0.5, time: 0, maxWidth: 200 });
                    Y.API2('DwShop', 'ModifyDwShop', {
                        list: list,
                        UserCode: $('#search-operator').val()
                    }, function (data) {
                        layer.closeAll('dialog');
                        if (data.Success == false) {
                            swal(data.Message, '', 'error');
                        } else {
                            swal('修改成功', '', 'success');
                            $('#btn-search').click();
                        }
                    })
                } else {
                    //批量
                    $('#pageList .checkStore:checked').each(function () {
                        var tr = $(this).parents('tr');
                        list.push({
                            ShopCode: tr.find('.shopCode').text()
                        })
                    })
                    var submitJson = {
                        list: list,
                        UserCode: $('#search-operator').val()
                    }
                    switch ($('#dayType').val()) {
                        case '0':
                            submitJson.newTransportDay = $('#setDays').val();
                            break;
                        case '1':
                            submitJson.newReplenishDay = $('#setDays').val();
                            break;
                        case '2':
                            submitJson.newBillandPickDay = $('#setDays').val();
                            break;
                        case '3':
                            submitJson.newShopRate = $('#setDays').val();
                            break;
                    }
                    layer.msg('玩命加载中……', { icon: 16, shade: 0.5, time: 0, maxWidth: 200 });
                    Y.API2('DwShop', 'ModifyDwShopList', submitJson, function (data) {
                        layer.closeAll('dialog');
                        if (data.Success == false) {
                            swal(data.Message, '', 'error');
                        } else {
                            swal('批量修改成功', '', 'success');
                            $('#btn-search').click();
                        }
                    })
                }
            })

            //批量设置时间
            $('.btns-container').on('click', '#saveTimes', function () {
                if ($('#pageList .checkStore:checked').size() == 0) {
                    swal('请先选择店铺');
                    return false;
                }
                //  	if($('#dealDate').val() == ''){
                //  		swal('请输入下次补货时间');
                //  		return false;
                //  	}

                var Value = "";
                $(".checkBoxTime:checked").each(function () {
                    if ($(this).is(":checked")) {
                        Value += $(this).val() + ',';
                    }
                });

                var list = [];
                $('#pageList .checkStore:checked').each(function () {
                    var tr = $(this).parents('tr');
                    list.push({
                        ShopCode: tr.find('.shopCode').text()
                    })
                })

                Y.API2('DwShop', 'ModifyDwShopList', {
                    list: list,
                    UserCode: $('#search-operator').val(),
                    newSuppleWeekText: Value.substring(0, Value.length - 1)
                }, function (data) {
                    if (data.Success == false) {
                        swal(data.Message, '', 'error');
                    } else {
                        swal('修改成功', '', 'success');
                        $('#btn-search').click();
                    }
                })
            })

            //隐藏显示 设置栏
            var state = false;
            $("#toggle").click(function () {
                if (state) {
                    $("#paramSet,#tips").addClass("hide");
                    state = false;
                    $(this).text("展开设置 >>");
                    rScroll();
                }
                else {
                    $("#paramSet,#tips").removeClass("hide");
                    state = true;
                    $(this).text("隐藏设置 <<");
                    //console.log("展开设置");
                }
            });


        })
    </script>
</asp:Content>

